// 
//$(document).ready(function(){
//	$("#login").click(function(){
//$.ajax({
//
//	url:'http://localhost:8080/easyskool/rest/userauthservice/validateCredentails',
//	type:'POST',
//	data: '{"user":"'+$("#user").val()+'","password":"'+$("#pwd").val()+'"}',
//	dataType: 'json',
//	async:false,
//	contentType: "application/json; charset=utf-8",
//	success:function (data,testStatus,response) {
////		$response = jqXHR.responseText;
//		$a = response.responseText;
//
//		var json =JSON.parse(response.responseText);// $.parseJSON(response.responseText);
//		if(json.statusCode==200){
//			if(json.priviledgedLevel == 2){
////				session.setAttribute("username", $("#user").val());
//				window.location = "http://localhost:8080/easyskool/WebPages/Masters/MasterClassHome.jsp";
//			}
//		}
//
//		var json =JSON.parse(response.responseText);
//		alert(json.statusCode);
//		window.location="http://localhost:8080/easyskool/WebPages/Masters/masterSubjectHome.jsp";
//	},
//	error:function(data,testStatus,jqXHR){
//		alert("Bad thing happend! " + jqXHR+data.responseText+" "+testStatus);
//	}
//});
//	});
//});
 
 
$(document).ready(function(){
	$("#login").click(function(){
$.ajax({
	async: false,
	url:'/easyskool/rest/userauthservice/validateCredentails',
	type:'POST',
	data: '{"user":"'+$("#user").val()+'","password":"'+$("#pwd").val()+'"}',
	dataType: 'json',
	contentType: "application/json; charset=utf-8",
	success:function (data,testStatus,jqXHR) {
		var json = jQuery.parseJSON(jqXHR.responseText);
		if(json.responseMessage == "error"){
			window.location=host+"/easyskool/Login/login.jsp?auth=fail";
			}
		else
			{
			window.location=json.responseMessage;			
			}
		
	}
});
	});
});
 


